import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
import path from "path";

export default defineConfig({
  plugins: [vue()],
  base: './',
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    proxy: {
      '/simpleWeather': {           //匹配网络请求发送的基地址，进行拦截
        target: 'http://apis.juhe.cn/simpleWeather/',   //服务器地址带上基地址
        changeOrigin: true,   //是否允许跨域
        rewrite: (path) => path.replace(/^\/simpleWeather/, '')   //重写路径
      }
    }
  },

});